package com.example.demo.common;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2023-09-17
 * Time: 10:22
 */

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 统一异常处理
 */
//异常返回的是非静态页面的数据,所以用的是该注解
@RestControllerAdvice
public class ExceptionAdvice {
    @ExceptionHandler(Exception.class)
    public  ResultAjax doException(Exception e){
        return ResultAjax.fail(-1,e.getMessage());

    }
}
